﻿@{
    ViewBag.Title = "练习统计结果";
    Layout = "~/Views/Shared/_GridCommonLayout.cshtml";
}








<!--begin grid code-->


<section id="widget-grid" class="">
    <div class="row">



        <!--Operation-->
        <div class="heading-buttons">


            <div class="col-xs-12 col-sm-7 col-md-7 col-lg-4">
                <h1 class="page-title txt-color-blueDark"><i class="fa fa-desktop fa-fw "></i>
                    练习统计结果
			
                </h1>
            </div>
            <div class="buttons pull-right">

            
                <a href="/Teacher/Practice?courseId=@ViewBag.CourseID" class="btn btn-danger">返回</a>

            </div>
            <div style="clear: both;">
            </div>
        </div>
        <!--/Operation-->




                <!--Search-->
                <div class="filter-bar">
                    <form id="formSearch">
                        <div class="lbl glyphicons search" style="cursor: pointer;" data-bind="click: $root.search">
                            <i></i>筛选
                        </div>


                        <div>
                            <label>学生姓名：</label><div class='input-append'>
                                <input id='txtbSrSStuName' name='txtbSrSStuName' type='text' placeholder='' class='input-mini' style='width: 120px;' /></div>
                        </div>
                         <input id='txtbSrICourseId' name='txtbSrICourseId' type='hidden' value="@ViewBag.courseId" />
                         <input id='txtbSrITeaId' name='txtbSrITeaId' type='hidden' value="@ViewBag.teaId" />

                        <div class="clearfix">
                        </div>
                    </form>
                </div>
                <!--/search-->



                <article class="col-xs-12 col-sm-12 col-md-12 col-lg-12 sortable-grid ui-sortable">
                    <div id="wid-id-0" class="jarviswidget jarviswidget-color-darken jarviswidget-sortable" data-widget-editbutton="false">
                        <header>
                            <span class="widget-icon"><i class="fa fa-table"></i></span>
                            <h2>结果统计</h2>
                        </header>
                        <div style="margin-top: 35px;">
                            <div class="jarviswidget-editbox"></div>
                            <div class="widget-body no-padding">
                                <div role="grid" id="providerGrid" class="dataTables_wrapper form-inline">
                                    <div class="table-responsive">

                                        <div class="dt-wrapper" style="overflow-y: auto;">
                                            <table class="table table-striped table-bordered table-hover checkboxs">
                                                <!--table head-->
                                                <thead>
                                                    <tr>
                                                       
                                                        <!-- ko foreach: headers -->
                                                        <th class="left ">
                                                            <a href="#" data-bind="text: displayText, click: $root.sort" style="color: black"></a>
                                                            <i class="icon-circle-arrow-up" data-bind="    visible: value == $root.orderBy() && $root.isAsc()"></i>
                                                            <i class="icon-circle-arrow-down" data-bind="    visible: value == $root.orderBy() && !$root.isAsc()"></i>
                                                        </th>
                                                        <!-- /ko -->
                                         
                                                    </tr>
                                                </thead>
                                                <!--/table head-->
                                                <!--table body(Provider list)-->
                                                <tbody data-bind="foreach: recordSet">
                                                    <tr class="selectable" onclick="">
                                              
                                                            <input type="hidden" name="userSelector" data-bind="value: Id" />
                                                            <input type="hidden" data-bind="value: Id, attr: { id: Id }" />
                                                     
                                                        <td class='left'><strong data-bind='text: SStuNo'></strong></td>   
                                                        <td class='left'><strong data-bind='text: SStuName'></strong></td>                                           
                                                        <td class='left'><strong data-bind='text: IComplete'></strong></td>
                                                        <td class='left'><strong data-bind='text: IIncomplete' style="color:red"></strong></td>
                                                        <td class='left'><strong data-bind='text: ITotal'></strong></td>
                                                    </tr>
                                                </tbody>
                                                <!--/table body( Provider list)-->

                                            </table>

                                        </div>



                                        <!-- 分页 -->
                                        <ul class="pagination pagination-alt">
                                            <li>
                                                <a data-bind="click: firstPage"><i class="fa fa-fast-backward "></i></a>
                                            </li>
                                            <li>
                                                <a data-bind="click: prevPage"><i class="fa  fa-backward  "></i></a>
                                            </li>
                                            <li>
                                                <a>
                                                    <input id="toPage" type="text" data-bind="value: pageIndex, event: { change: $root.changePageIndex }" style="width: 25px;" />
                                                    /共<span data-bind="html: totalPages"></span>页 
                                                </a>
                                            </li>
                                            <li>
                                                <a data-bind="click: nextPage"><i class="fa fa-forward "></i></a>
                                            </li>
                                            <li>
                                                <a data-bind="click: lastPage"><i class="fa fa-fast-forward "></i></a>
                                            </li>
                                        </ul>

                                        <div class="dt-top-row total  ">
                                            当前记录共：<span data-bind="html: totalCount"></span>条
                                        </div>
                                        <!--end 分页-->
                                    </div>

                                    <!-- /分页 -->


                                </div>

                                <!-- /分页 -->




                            </div>
                        </div>

                    </div>




                </article>

            </div>
            <!--end row-->
</section>



<script type="text/javascript">

    var gdViewModel;
    $(function () {
        $._messengerDefaults = {
            extraClasses: 'messenger-fixed messenger-theme-future messenger-on-bottom messenger-on-right'
        }; //默认提示位置;


        var options = {

            dialogId: "StuPracticeResultMessageModal", //添加对话框

            pageSize: 20, //分页大小
            hidId: $("#txtbID"),
            SaveUpdateBtn: $("#btnSaveOrUpdateModel"),
            frmElement: $("#formStuPracticeResult"),

            //节点数据
            NodeValue: ko.observable({

                Id: 0,
                IStuId: 0,
                SStuName: '',
                ICourseId: 0,
                ITeaId: 0,
                ITermId: 0,
                IComplete: 0,
                IIncomplete: 0,
                ITotal: 0,


            }),


            //用户列表Grid头部列名称
            headers: [

 { displayText: '学生学号', value: 'SStuNo', width: 'auto' },
 { displayText: '学生姓名', value: 'SStuName', width: 'auto' },
 { displayText: '完成次数', value: 'IComplete', width: 'auto' },
 { displayText: '未完成次数', value: 'IIncomplete', width: 'auto' },
 { displayText: '总次数', value: 'ITotal', width: 'auto' }


            ],

            //默认的排序方式
            defaultOrderBy: "Id",
            //用户查询URL
            dataQueryUrlAccessor: function () {
                return "/api/StuPracticeResult/GetByPage";
            },

            //添加用户URL
            dataAddUrlAccessor: function () { return "/api/StuPracticeResult/Post"; },
            dataUpdateAccessor: function (key) { return "/api/StuPracticeResult/Put/" + key; },
            dataNodeSelect: function (id) {
                return "/api/StuPracticeResult/get/" + id;
            },

            dataDeleteAccessor: function (data) {
                var userIDs = "";
                var check = $("input:checked");  //得到所有被选中的checkbox
                check.each(function (i) {        //循环拼装被选中项的值
                    userIDs = userIDs + ',' + $(this).val();
                });
                //清除多余的分割号
                userIDs = dropRsplit(userIDs, ",");
                if (userIDs != "") {
                    return appendQueryString("/api/StuPracticeResult/Delete", { ids: userIDs });
                } else
                    return "";

            }
			, initEd: function () {
			    //gird初始化的后置事件 信息

			}


        };

        gdViewModel = new gridViewModel(options);


        gdViewModel.init();
        ko.applyBindings(gdViewModel);


        options.frmElement.validate({
            rules: {

            },
            messages: {

            }
        });


    });

</script>






<!--/end grid code-->

